<?php
function loader(){
    
    define('CORE_REQUIRES_PATH', CORE_PATH . 'requires' . DS );
    
    recursive_requires(CORE_PATH . "requires");
}

function recursive_requires($entry){
    $entry = rtrim($entry, DS);
    if(is_file($entry)):
        require_once $entry;
        return;
    elseif($entry == dirname($entry) . DS . '.' || $entry == dirname($entry) . DS . '..'):
        return;
    else:
        $entries = scandir($entry);
        foreach($entries as $new_entry):
            recursive_requires($entry . DS . $new_entry); // $entry is the path of $new_entry
        endforeach;        
    endif;
    return;
}
?>
